<template>
	<view>
		<cu-custom :bgLinerBorder="true" :isBlack="false">
			<block slot="content">点餐记录</block>
		</cu-custom>
		<view class="p-l-15 p-r-15 p-t-5 p-b-20">
			<view class="restaurant-item flex align-center" v-for="(item,index) in list" :key="index" @click="toDetail(item)">
				<!-- <view class="flex align-center">
					<image src="/static/img/log-bg.png" class="restaurant-img"></image>
				</view> -->
				<view class="p-l-15 p-r-15">
					<view class="restaurant-desc fontBold">
						<view class="orange f-16">
							{{item.name}}
						</view>
						<view class="f-12 m-t-2 ">
							人数：{{item.user_num}}人
						</view>
						<view class="f-12 m-t-2 ">
							时间：{{item.book_at}}
						</view>
						<view class="f-12 m-t-2 ">
							包间：{{item.compartment_name}}
						</view>
						<view class="f-12 m-t-2 ">
							车牌：{{item.car_num}}
						</view>
						<view class="f-12 m-t-2">
							联系方式：{{item.username}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:1,
				last_page:1,
				id:0
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getIndex();
		},
		onReachBottom(){
			if(this.page >= this.last_page)return;
			this.page++;
			this.getIndex();
		},
		methods: {
			toDetail(item){
				uni.navigateTo({
					url:'/pages/other/dineLog?id='+item.id
				})
			},
			getIndex(){
				let data = {
					page:this.page,
					shop_id:this.id
				}
				this.$http('/apimanager/User/userOrderList',data).then(res=>{
					if(res.code == 200){
						let datas = res.data;
						let list = datas.list.data;
						this.last_page = datas.list.last_page;
						if(this.page == 1){
							this.list = list;
						}else{
							this.list = this.list.concat(list);
						}
						
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.restaurant-item{
		margin-top: 24rpx;
		background: rgba(255,255,255,1);
		box-shadow: 0px 0px 16px rgba(0,0,0,0.05);
		border-radius: 16rpx;
		padding: 20rpx 30rpx;
		.restaurant-img{
			width: 160rpx;
			height: 160rpx;
			border-radius: 50%;
		}
		.restaurant-desc{
			
			position: relative;
			z-index: 2;
		}
	}
</style>
